package task

import (
	"github.com/go-redis/redis"
	_ "github.com/go-sql-driver/mysql"
	"github.com/go-xorm/xorm"
)

var engine *xorm.Engine
var redisClient *redis.Client

func NewEngine(source string) error {
	var err error
	engine, err = xorm.NewEngine("mysql", source)

	return err
}

func NewRedis(source string, db int) error {
	redisClient = redis.NewClient(&redis.Options{
		Addr:     source,
		Password: "", // no password set
		DB:       db, // use default DB
	})

	return nil
}
